package com.sky.yipinyoufujava.controller;


import com.sky.yipinyoufujava.pojo.from.GetSingleOrderGoodsFrom;
import com.sky.yipinyoufujava.result.Result;
import com.sky.yipinyoufujava.service.AddressService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class AddressConteroller {
    @Autowired
    private AddressService addressService;


    /**
     * 获取用户的地址
     * @param userId
     * @return
     */
    @PostMapping("/getUserAddress")
    private Result getUserAddress(@RequestBody String userId){
        log.info("用户id,{}",userId);
        return Result.success(addressService.getUserAddress(userId));
    }


    /**
     * 获取订单的id
     * @param orderId
     * @return
     */
    @PostMapping("/getOrderAddress")
    private Result getOrderAddress(@RequestBody GetSingleOrderGoodsFrom orderId){
        log.info("订单id,{}",orderId);
        return Result.success(addressService.getOrderAddress(orderId));
    }
}
